package com.lfd.jvm;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.lfd.jvm.config.TestDataSource;
import com.lfd.jvm.config.TestText;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@Slf4j
@SpringBootApplication
public class JvmApplication implements CommandLineRunner {
    @Autowired
    private TestText testText;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private TestDataSource testDataSource;

    public static void main(String[] args) {
        SpringApplication.run(JvmApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
//        String string = objectMapper.writeValueAsString(testText);
        log.info("=====string:text1:{},text2:{}", testText.getText1(), testText.getText2());
        log.info("=====testDataSource:{}", testDataSource);
//        String string = objectMapper.writeValueAsString(testDataSource);
//        log.info("=====testDataSource2:{}", string);
    }
}
